/**
 * 
 */
package com.qf.apps;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import com.qf.domain.Course;
import com.qf.service.CourseService;

/**
 * @author dxx
 * 
 */
public class IndexController implements Controller {
	private CourseService courseService;

	public ModelAndView handleRequest(HttpServletRequest arg0,
			HttpServletResponse arg1) throws Exception {
		List courses = this.courseService.listFew();
		return new ModelAndView("/index", "courses", courses);
	}

	public CourseService getCourseService() {
		return courseService;
	}

	public void setCourseService(CourseService courseService) {
		this.courseService = courseService;
	}
	
	public static void main(String[] args) {
		Calendar now = Calendar.getInstance();
		System.out.println(now.getTime());
		String test = "abcdefg";
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		System.out.println(sdf.format(now.getTime()));
	}

}
